Add validate_geojson_tool for offline GeoJSON validation#50
Merged
Conversation
This commit adds a comprehensive GeoJSON validation tool that performs offline validation of GeoJSON objects without requiring API access. Features: - Validates all GeoJSON types (Feature, FeatureCollection, Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon, GeometryCollection) - Checks required properties (type, coordinates, geometry, features) - Validates coordinate array structure and position validity - Warns about longitude/latitude out of range - Detects unclosed polygon rings - Calculates statistics (type, feature count, geometry types, bounding box) - Returns structured errors, warnings, and info messages with suggestions - Accepts both JSON strings and objects as input The tool is implemented as a BaseTool (offline, no HttpRequest dependency) and includes 28 comprehensive test cases covering valid and invalid GeoJSON, coordinate validation, error handling, and statistics calculation. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This was referenced Jan 8, 2026
mattpodwysocki
added a commit
that referenced
this pull request
Jan 9, 2026
…roduction prompt Adds comprehensive style quality validation capabilities: Skill: - Created mapbox-style-quality skill document (390+ lines) - Pre-production checklist and validation best practices - Guidance on expression validation, GeoJSON validation, and accessibility - Optimization strategies and workflow recommendations - Integration patterns for Git hooks, CI/CD, and code review Prompt: - Created prepare-style-for-production prompt - Orchestrates validation workflow using 5 quality tools: * validate_expression_tool - Validate expressions in filters/paint/layout * validate_geojson_tool - Validate GeoJSON sources * check_color_contrast_tool - WCAG accessibility compliance * optimize_style_tool - Remove redundancies and optimize * compare_styles_tool - Compare versions (implicit in workflow) - Configurable WCAG level (AA/AAA) and optional optimization skip - Generates comprehensive quality report with deployment readiness assessment Testing: - 15 test cases for PrepareStyleForProductionPrompt - All 386 tests passing - Updated prompt registry tests Documentation: - Updated README with new skill listing - Added prompt documentation with usage examples - Cross-referenced skill and prompt Related PRs: - PR #50: validate_geojson_tool - PR #51: validate_expression_tool - PR #52: compare_styles_tool - PR #53: check_color_contrast_tool - PR #54: optimize_style_tool Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Valiunia
previously approved these changes
Jan 9, 2026
Valiunia
approved these changes
Jan 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a comprehensive offline GeoJSON validation tool that checks GeoJSON objects for correctness without requiring API access.
Features
✅ Validates all GeoJSON types:
✅ Comprehensive validation checks:
✅ Structured validation results:
validboolean flagerrorsarray (critical issues)warningsarray (non-critical issues)infoarray (informational messages)statisticsobject (type, feature count, geometry types, bbox)✅ Developer-friendly:
Implementation Details
BaseTool(offline, no HttpRequest dependency)Test Results
All 398 tests pass ✅
Example Usage
{ "geojson": { "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "properties": { "name": "Test Point" } } }Returns:
{ "valid": true, "errors": [], "warnings": [], "info": [], "statistics": { "type": "Feature", "featureCount": 1, "geometryTypes": ["Point"], "bbox": [102.0, 0.5, 102.0, 0.5] } }Related
Part of a series of offline validation tools being added to the server. This is the second tool after validate_style_tool (#49).
Test Plan
Test 1: Valid Point Feature ✅
Can you validate this GeoJSON?
Expected: Valid, returns statistics (1 feature, Point geometry, bbox)
Test 2: Valid Polygon ✅
Validate this polygon:
Expected: Valid, polygon ring is properly closed (first and last coordinates match)
Test 3: Invalid Coordinates (Out of Range) ❌
Check if this GeoJSON is valid:
Expected:
Test 4: Unclosed Polygon ❌
Is this polygon valid?
Expected:
Test 5: Valid FeatureCollection ✅
Validate this collection:
Expected:
Test 6: Wrong Coordinate Order (Common Mistake)⚠️
Check this point:
Expected: